<!doctype html>
<html>
<!-- InstanceBegin template="/Templates/template1.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta charset="utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>代金券明细</title>
<!-- InstanceEndEditable -->
<script type="text/javascript" src="../js/common.js"></script>
<link href="../css/Pager.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../js/jquery.pager.js"></script>
<script type="text/javascript" src="../js/gbRst.js"></script>
<link href="../css/style.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../js/utils.js"></script>
<script type="text/javascript" src="../js/shopSelecterNew.js"></script>
<script type="text/javascript" src="../js/checkLogin.js"></script>
<script type="text/javascript" src="../js/pagination.js"></script>
<script type="text/javascript" src="../js/find.js"></script>
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<script type="text/javascript" >
$(function(){
	refreshInput($(".serWrapper"));
	$("#shopIsChoosed").click(function(){
		if($("#shopIsChoosed").is(":checked")){
			$("#shopName").attr("disabled",false);
			$("#research").attr("disabled",false);
			
		}else{
			$("#shopName").attr("disabled",true);

		}
	});

	 $('#dtBegin').val(getToday());
	 $('#dtEnd').val(getToday());
})

function InitTables(index) {
	var memberCardNo=$("#memberCardNo").val().replace(/\s/gi,'');
	var workNo=$("#workNo").val().replace(/\s/gi,'');
	var dtBegin=$("#dtBegin").val().replace(/\s/gi,'');
	var dtEnd=$("#dtEnd").val().replace(/\s/gi,'');
	var shopId='';
	if($("#shopIsChoosed").is(":checked")){
		var  id=$("#shopName").val();
		if(id!=""&&id!=null){
			shopId = id
		}
	}
	var param={'workNo':workNo, 'memberCardNo':memberCardNo,"dtBegin":dtBegin,"dtEnd":dtEnd,"shopId":shopId}
	
	var info = _findInfo("../intConsumCpon/find/all/" + (index -1) + "/10", param)
		if(info.state==0){
			var params = new Array("shopName","WorkNo","Date","memberCarcNo","custName","ConsumeAmout")
/* 			_loadInfo(info, "memberList", params)
 */			_loadPage("pager", index, 10, info, InitTables, "NoResult");
			$("#memberList tbody").empty()
			for ( var i = 0; i < info.result.data.length; i++) {
					var htm  ="<tr>"
					for ( var j = 0; j < params.length; j++) {
					if(params[j] == "WorkNo")	{
					htm +="<td> <a style='color:blue;outline:medium;text-decoration:underline' href=\"bussBillDetil.html?no="+ _getStringOfJson(i, info, params[j]) +"&shopId="+ _getStringOfJson(i, info,"shopId" ) +" \" target = \"_blank\">"+ _getStringOfJson(i, info, params[j]) +"</a> </td>" 
						
					}else{
						htm +="<td> "+ _getStringOfJson(i, info, params[j]) +" </td>" 
					}
				
					}
					htm+= "</tr>"
			$("#memberList tbody").append(htm)
		}
		 	$("#sup").html("共"+info.result.len+"条");	
	
		}
	
	var sum = _findInfo("../intConsumCpon/find/sum", param);
	if(sum.state==0){
	 	$("#sum").html("总计："+getHtmlInt(sum.result.data[0][0])+"元");	
	}
	
	
}

function  downRescouse(){
	var workNo=$("#workNo").val().replace(/\s/gi,'');
	var memberCardNo=$("#memberCardNo").val().replace(/\s/gi,'');
	var dtBegin=$("#dtBegin").val().replace(/\s/gi,'');
	var dtEnd=$("#dtEnd").val().replace(/\s/gi,'');
	var shopId="";
	var param='workNo='+workNo+'&memberCardNo='+memberCardNo+"&dtBegin="+dtBegin+"&dtEnd="+dtEnd;
	if($("#shopIsChoosed").is(":checked")){
		shopId=$("#shopName").val();
		if(shopId!=""&&shopId!=null){
			param+="&shopId="+shopId;
		}
	}
	param+="&downType=14"
	
	window.location.href="../csvdown/down/csv/down?"+param

}
</script>
</head>

<body>

<!-- InstanceBeginEditable name="EditRegion3" --> 
<script type="text/javascript" src="../js/doubleDate2.0.js"></script> 
<script type="text/javascript">
$(function(){
	refreshInput($(".serWrapper"));
	$('.doubledate').kuiDate({
		className:'doubledate',
		isDisabled: "0"  // isDisabled为可选参数，“0”表示今日之前不可选，“1”标志今日之前可选
	});

});
</script>
<div class="container" id="container">
  <div class="container_R fr">
    <div class="place">代金券明细</div>
    <div class="member_search">
      <p><span>
        <input type="checkbox" id="shopIsChoosed" style="width:auto;height:auto;border:none;">
        店面：</span>
        <select id="shopName" onclick="openShopListPanel(this)" style=";height:20px;" disabled="disabled">
        </select>
        <span>起始日期：</span>
        <input type="text" readonly class="doubledate ipticon"  id="dtBegin"/>
        <span>截止时间：</span>
        <input type="text" readonly class="doubledate ipticon" id="dtEnd"/>
      </p>
      <p>
        <span>会员卡号：</span>
        <input type="text" id="memberCardNo" class="absoluteTxt">
      <span>单号</span>
      <input type="text" id="workNo" class="absoluteTxt" >
      <input type="button" value="查询" class="btn" onclick="InitTables(1)">
      </p>
    </div>
    <table width="100%" class="member_list" cellpadding="0" cellspacing="1" border="0" id="memberList">
      <caption>
      <strong>返利列表 <span id="sup">共0条</span></strong> <a href="javascript:void(0)" onclick="downRescouse()">导出数据</a>
      </caption>
      <thead>
        <tr>
          <th>店名</th>
          <th>单据号</th>
          <th>使用时间</th>
          <th>会员卡号</th>
          <th>会员姓名</th>
          <th>使用金额</th>
        </tr>
      </thead>
      <tbody></tbody>
    </table>
     <div id="NoResult"  class="Nothing" style="text-align:center;display: none;">无符合条件的数据！</div>
    <div id="sum" style="float: left;"></div>
    <div id="pager" style="float: right;"></div>
  </div>
  <div class="fc"></div>
</div>
<!-- InstanceEndEditable --> 
<script type="text/javascript" src="../js/header.js"></script> 
<script type="text/javascript" src="../js/left.js"></script> 
<script type="text/javascript" src="../js/footer.js"></script> 
<script type="text/javascript">
clearThis("absoluteTxt");
showTab(4,7);
</script>
</body>
<!-- InstanceEnd -->
</html>
